home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / bit / src / proto.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  18KB  |  533 lines

  1. /*
  2.  * $Id: proto.h,v 0.91 1994/02/20 00:53:37 zhao Pre-Release $
  3.  *
  4.  *. This file is part of BIT shareware package. After the two weeks of
  5.  *  free evaluation period, you are encouraged (required) to register
  6.  *  your copy for a small registration fee, which is $35 for personal use
  7.  *  and $50 for commercial, government and institutional use.
  8.  *
  9.  *  Copyright(c) 1993, 1994 by T.C. Zhao.
  10.  *  All rights reserved.
  11.  *
  12.  *  Permission to use, copy, and distribute this software in its entirety
  13.  *  for non-commercial purposes is hereby granted, provided that the
  14.  *  above shareware and copyright notices and this permission notice
  15.  *  appear in all copies and their documentation.
  16.  *
  17.  *  This software may be modified for your own use, but modified versions
  18.  *  may not be distributed without prior consent of the author.
  19.  *
  20.  *  This software is provided "as is" without expressed or implied
  21.  *  warranty of any kind.
  22.  *
  23.  *.
  24.  *
  25.  * Function prototypes. All char * is const while char [] is not
  26.  *
  27.  */
  28. #ifndef BIT_PROTO_H
  29. #define BIT_PROTO_H
  30.  
  31. /*
  32.  * Just something to make compiler happy in case some of the definations
  33.  * are not included
  34.  */
  35. #if  !defined(BIT_H) && !defined(BIT_UTYPE_H)
  36. typedef void (*IPTR);
  37. typedef void (*FLIST);
  38. typedef void (*CMPTR);
  39. typedef void (*FL_OBJECT);
  40. typedef void (*FL_FORM);
  41. #endif
  42.  
  43. /**********************************************************
  44.  * General stuff
  45.  *********************************************************/
  46. extern void version_cb(FL_OBJECT *, long);
  47. extern const char *is_image_file(const char *);
  48. extern IPTR open_image(const char *);
  49. extern IPTR open_image_fp(FILE *, const char *);
  50. extern IPTR load_image(const char *);
  51. extern IPTR load_image_fp(FILE *, const char *);
  52. extern void close_image(IPTR);
  53. extern int write_image(const IMG_IO *, IPTR, const char *);
  54. extern void Generic_display(IPTR, int, int);
  55. extern void display_image(IPTR, int, int);
  56. extern int handle_multi_images(IPTR);
  57.  
  58. extern const char *gds_string(void);
  59. extern FILE *msg_fopen(const char *, const char *);
  60. extern FILE *get_BITfile_fp(const char *, const char *);
  61. extern FILE *get_HELPfile_fp(const char *, const char *);
  62. extern const char *get_TMPfile(const char *);
  63. extern FILE *get_TMPfile_fp(const char *, const char *);
  64. extern const char *get_HELPFile(const char *);
  65.  
  66.  
  67. extern void bit_iconify(void);
  68. extern void bit_de_iconify(void);
  69. extern void bit_draw_icon(int);
  70.  
  71. /***********************************************************
  72.  * Supported image formats
  73.  *********************************************************{*/
  74.  
  75. /******************* IRIS RGB format ****************************/
  76.  
  77. extern int RGB_desc(IPTR), RGB_load(IPTR), RGB_dump(IPTR);
  78.  
  79. /****************** PNM format *********************************/
  80.  
  81. extern int PNM_desc(IPTR), PPM_load(IPTR), PPM_dump(IPTR);
  82. extern int PBM_load(IPTR), PBM_dump(IPTR);
  83. extern int PPMdump_init(IPTR);
  84. extern const char *PPM_wdefault(const IPTR);
  85. extern void set_pnm_raw(int);
  86.  
  87. /****************** JFIF  format ********************************/
  88.  
  89. extern int JPEG1_desc(IPTR), JPEG1_load(IPTR), JPEG1_dump(IPTR);
  90. extern int JPEG1dump_init(IPTR);
  91. extern const char *JPEG1_wdefault(const IPTR im);
  92.  
  93. /****************** X bitmaps ***********************************/
  94.  
  95. extern int XBM_desc(IPTR), XBM_load(IPTR), XBM_dump(IPTR);
  96. extern void bw_special(IPTR);
  97.  
  98. /***************** CompuServ GIF format *************************/
  99.  
  100. extern int GIF_desc(IPTR), GIF_load(IPTR), GIF_dump(IPTR);
  101. extern int GIFdump_init(IPTR);
  102. extern const char *GIF_wdefault(const IPTR);
  103.  
  104. /******************* PostScript ***************************/
  105.  
  106. extern int PS_desc(IPTR), PS_load(IPTR), PS_dump(IPTR), PSdump_init(IPTR);
  107. extern int PS_next(IPTR, int);
  108. extern const char *PS_wdefault(const IPTR), *gps_res_string(void);
  109.  
  110. /**************** Sun Rasterfile format   **********************/
  111.  
  112. extern int RAS_desc(IPTR), RAS_load(IPTR), RAS_dump(IPTR);
  113.  
  114. /**************** MPEG files  **********************************/
  115.  
  116. extern int MPEG_desc(IPTR), MPEG_load(IPTR);
  117. extern int MPEG_next(IPTR, int);
  118.  
  119. /***************** Format for developing bit ********************/
  120.  
  121. extern int PAT_dump(IPTR), PAT_desc(IPTR);
  122. extern int CUR_dump(IPTR), CUR_desc(IPTR);
  123.  
  124. /*************** Formats not directly supported, but cheats ********/
  125.  
  126. /* Compressed image: reading only.  */
  127.  
  128. extern int Compress_desc(IPTR), Compress_load(IPTR);
  129.  
  130. /* TIFF support thru fromtiff/totiff or tifftopnm/pnmtotiff     */
  131.  
  132. extern int TIFF_desc(IPTR), TIFF_dump(IPTR), TIFF_load(IPTR);
  133. extern int TIFF_dumpinit(IPTR);
  134. extern const char *TIFF_wdefault(const IPTR);
  135.  
  136. /************ X-ray photo-emission hologram *****************/
  137.  
  138. extern int HOLO_desc(IPTR), HOLO_load(IPTR), HOLO_dump(IPTR);
  139. extern const char *HOLO_wdefault(const IPTR);
  140. extern int HOLOdump_init(IPTR);
  141. extern void HOLO_special(IPTR);
  142.  
  143. /* my own stuff */
  144. extern int TC_desc(IPTR), TC_load(IPTR);
  145.  
  146. /******************** swap file ********************************/
  147.  
  148. extern int TMP_desc(IPTR), TMP_load(IPTR), TMP_dump(IPTR);
  149. extern int TMPdump_init(IPTR);
  150. extern const char *TMP_wdefault(const IPTR);
  151.  
  152. /************** End of formats *******************************}*/
  153.  
  154.  
  155. /***************************************************************
  156.  * General 2D raster transformations
  157.  **************************************************************/
  158.  
  159. extern int img_tran(IPTR, int, int, float[][2], float[], rgba_t, int);
  160.  
  161. /*
  162.  * image panning and zooming
  163.  */
  164. extern void center_image(IPTR, int);
  165. extern int get_pan_speed(void);
  166. extern int image_pan(IPTR, int, int);
  167. extern int image_zoom(IPTR);
  168. extern void auto_pan(IPTR);
  169.  
  170. extern long show_info_window(int, int, int, int, int);
  171. extern int save_win_position(int);
  172. extern long show_control_window(int, int, int, int, int);
  173. extern void set_control_window_position(int, int);
  174. extern void set_info_window_position(int, int);
  175. extern void write_control_window_position(FILE * fp);
  176. extern void write_info_window_position(FILE * fp);
  177. extern void show_mouse_position(int, int);
  178. extern void hide_mouse_position(void);
  179. extern long get_info_wid(void);
  180. extern long get_control_wid(void);
  181. extern void hide_info_window(void);
  182. extern void hide_control_window(void);
  183. extern void show_clock_mailbox(int, int, int, int);
  184. extern void remove_clock_mailbox(void);
  185. extern void update_filename(char *);
  186. extern void update_format_info(IPTR);
  187. extern void update_misc_info(IPTR);
  188. extern void update_image_info(IPTR);
  189. extern void update_color_info(IPTR);
  190. extern void update_size_info(int, int);
  191. extern char *rm_rcs_kw(const char *);
  192. extern void set_iformat_info(IPTR, const char *);
  193. extern void fb_to_ras(IPTR, const Rect_t *);
  194. extern void slideshow_off(void);
  195.  
  196. /*
  197.  * active list
  198.  */
  199. extern int add_to_list(const char *, const char *);
  200. extern int is_empty_list(void);
  201. extern int delete_from_list(const char *, const char *);
  202. extern int delete_from_list1(const char *);
  203. extern int is_on_list(const char *, const char *);
  204. extern const char *prev_file(void);
  205. extern const char *next_file(void);
  206. extern void load_files(void);
  207. extern int make_list(int, char *[]);
  208.  
  209. /****************************************************************
  210.  * Image manipulation or info reporting
  211.  ***************************************************************/
  212. extern int do_crop(IPTR);
  213. extern int img_diff(IPTR);
  214. extern int do_scp(IPTR);    /* simple cut & paste */
  215. extern int do_text(IPTR);    /* add text to image */
  216. extern int do_cut_paste(IPTR);
  217. extern int do_coledit(IPTR);
  218. extern int do_editmap(IPTR);
  219. extern int do_repaint(IPTR);
  220. extern int do_scale(IPTR);
  221. extern int do_rotate(IPTR);
  222. extern int do_ext_convolv(IPTR);
  223. extern int do_ext_filter(IPTR);
  224. extern int do_dump(IPTR);
  225. extern int do_merge(IPTR);
  226. extern int do_hspec(IPTR);
  227. extern int do_medianf(IPTR);
  228. extern int do_sharpen(IPTR);
  229.  
  230. extern int img_fft(IPTR);
  231. extern int img_smooth(IPTR);
  232. extern int img_paint(IPTR);
  233. extern int img_enhance(IPTR);
  234. extern int img_norm(IPTR);
  235. extern int img_measure(IPTR);
  236. extern int img_edge(IPTR);
  237. extern int pixel_edit(IPTR);
  238.  
  239. extern void pewin_iconify(void);
  240. extern void pewin_de_iconify(void);
  241.  
  242. extern int no_of_cut_paste_buffers(void);
  243. extern const char *cut_paste_buffer_name(int);
  244. extern void cleanup_cut_paste(void);
  245.  
  246. extern int init_text(void);
  247. extern int number_of_text(void);
  248. extern const char *get_text_fontname(int);
  249. extern const char *get_text_string(int);
  250. extern float get_text_fontsize(int);
  251. extern void get_text_location(int, int *, int *);
  252. extern int get_text_placement(int);
  253. extern void get_text_color(int, int *, int *, int *);
  254. extern float get_text_rotation(int);
  255. extern void text_to_gray(void);
  256. extern void text_to_cmap(void);
  257. extern void dump_text(FILE *);
  258. extern void get_text_bounds(IPTR, int *, int *, int *, int *);
  259. extern void img_add_text(IPTR, const char *, const char *, float,
  260.              float, rgba_t, int, int, int, rgba_t,
  261.              int, rgba_t, int, int);
  262. extern int get_fm_cache(void);
  263. extern int get_fm_cacheused(void);
  264.  
  265. extern void load_text(IPTR);
  266. extern void set_marking_origin(int, int);
  267. extern void set_marking_units(float, float);
  268. extern int img_marking(IPTR);
  269.  
  270. extern int img_show_histogram(IPTR);
  271. extern int ibrowse_dir(const char *);
  272. extern void del_thumbnail(const char *, const char *);
  273. extern void free_all_ibrowsers(void);
  274.  
  275. extern int img_scale(IPTR, int, int, int, int, rgba_t);
  276. extern int img_convolv(IPTR, int **, int, int, int *, const Rect_t *,
  277.                const char *);
  278. extern unsigned short *XBM_to_GL_pat(int, int, char *);
  279. extern int img_median_filter(IPTR, Rect_t *);
  280.  
  281. extern void update_dumpinfo(const char *);
  282. extern void free_all_ext_filter(void);
  283. extern void free_all_ext_convolv(void);
  284.  
  285. extern void display_text(IPTR);
  286. extern void del_text(void);
  287. extern void modify_rgb(rgba_t *, long, pc_t *, pc_t *, pc_t *);
  288. extern void modify_cmap(CMPTR, pc_t *, pc_t *, pc_t *);
  289. extern void modify_all_ci(ci_t *, long, ci_t *);
  290. extern void squeeze_image(IPTR);
  291. extern void do_ci_mask(ci_t *, unsigned int, unsigned int);
  292. extern void img_preserve_wm_colors(IPTR);
  293.  
  294. extern void display_sgf(IPTR);
  295. extern void del_marking(void);
  296. extern int number_of_sgf(void);
  297. extern const char *sgf_name(int);
  298. extern const char *sgf_psdraw(int);
  299. extern void get_sgf_color(int, int *, int *, int *);
  300. extern void get_sgf_info(int, int *, int *, int *, int *, int *, int *, int *);
  301. extern void get_sgf_bounds(IPTR, int *, int *, int *, int *);
  302. extern void sgf_to_gray(void);
  303. extern void sgf_to_cmap(void);
  304. extern void dump_sgf(FILE *);
  305. extern void load_sgf(IPTR);
  306. /*
  307.  * Progress report and misc. info reporting
  308.  */
  309. extern long progress_report(const char *, long);
  310. extern void update_progress_report(long);
  311. extern void remove_progress_report(void);
  312. extern void showit(const char *);
  313.  
  314. extern void show_rect_ori(int, int);
  315. extern void show_rect_size(int, int);
  316. extern void hide_rect_size(void);
  317. extern void show_rect_speed(int);
  318. extern void show_rect_all(int, int, int, int, int);
  319. extern void hide_rect_all(void);
  320. extern void show_misc_info(const char *);
  321. extern void hide_misc_info(void);
  322. extern void show_misc_info2(const char *);
  323. extern void hide_misc_info2(void);
  324.  
  325. /******************************************************
  326.  * Window manager resize, win position change handler
  327.  ******************************************************/
  328. extern void install_wm_handler(WMhandler);
  329. extern void remove_wm_handler(WMhandler);
  330. extern int total_wm_handler(void);
  331. extern void handle_wm_other(IPTR);
  332.  
  333. /*******************************************************
  334.  * Multiwindow redraw handlers
  335.  *****************************************************/
  336. extern void install_multiw_handler(MWhandler);
  337. extern void remove_multiw_handler(MWhandler);
  338.  
  339. /*****************************************************
  340.  * GL events handler
  341.  *****************************************************/
  342. extern void install_GLQ_handler(GLQhandler);
  343. extern void remove_GLQ_handler(GLQhandler);
  344. extern long handle_GLQ(long, short);
  345. extern int total_GLQ_handler(void);
  346.  
  347.  
  348. extern void bit_init(void);
  349. extern void open_main_window(IPTR);
  350. extern int get_scr_dpi(void);
  351. extern void repaint(IPTR, int);
  352. extern void set_current_window(long);
  353. extern void clean_up(void);
  354. extern void print_before_exit(void);
  355. extern void cleanup_files(void);
  356. extern void process_clean_up(void);
  357.  
  358. /*
  359.  * configuration
  360.  */
  361. extern void config_sys(void);
  362. extern int load_optfile(const char *, int);
  363. extern void hardware_constraints(int);
  364.  
  365. /* input/output  */
  366. extern int getint(const char *, int *, int, int, int);
  367. extern int getfloat(const char *, float *, float, float, int, int);
  368. extern const char *getstring(const char *, const char *, int);
  369. extern int yes_no(const char *, const char *, const char *, int where);
  370. extern void TC_continue(const char *, const char *, const char *, int);
  371. extern void set_message_color(int, int, int);
  372. extern void get_message_color(int *, int *, int *);
  373.  
  374. extern void get_theta(int, int, float *);
  375.  
  376. extern void img_rect_redraw(IPTR, int, int, int, int);
  377. extern void dbl_rect_redraw(IPTR, int, int, int, int);
  378. extern void draw_subimage(IPTR, int, int, int, int);
  379. extern int check_signature(FILE *, int[], const char *);
  380. extern void *get_subimage(IPTR, int, int, int, int);
  381. extern void *no_fail_get_subimage(IPTR, int, int, int, int);
  382. extern int put_subimage(IPTR, void *, const Rect_t *, int);
  383. extern int enlarge_image(IPTR, int, int, int, int, rgba_t);
  384.  
  385.  
  386. /*--------------------------------------------------------------
  387.  * Color selection
  388.  *-------------------------------------------------------------*/
  389.  
  390. typedef void (*Getcolor_cb) (int[]);
  391.  
  392. extern void set_getcolor_cb(Getcolor_cb);
  393. extern void set_getcolor_glcb(GLQhandler);
  394.  
  395. extern int get_color(IPTR, int[], int);
  396. extern void set_getcolor(int[]);
  397. extern void current_color(int[]);
  398. extern int get_RGBcolor(IPTR, int[], int);
  399. extern int get_cmapcolor(IPTR, int[], int);
  400. extern void set_getcolor_nohide(int);
  401. extern void hide_getcolor(void);
  402.  
  403. /*
  404.  * prototypes from iutil.c
  405.  */
  406. extern const char *image_vital_info(IPTR);
  407. extern void img_free_rastermem(IPTR);
  408. extern void img_free_rgbmem(IPTR);
  409. extern int img_get_rastermem(IPTR);
  410. extern void img_replace_rgb(IPTR, pc_t **, pc_t **, pc_t **);
  411. extern int img_get_rgbmem(IPTR);
  412. extern int img_get_rgb(IPTR);
  413. extern int image_ready(IPTR, const char *);
  414. extern int img_get_histogram(IPTR);
  415. extern IPTR img_dup(IPTR);
  416. extern int img_dup_raster(IPTR, IPTR);
  417. extern int img_dup_cmap(IPTR, IPTR);
  418. extern void init_w_formats(void);
  419. extern void check_emergency(void);
  420. extern void pausing(IPTR);
  421. extern void free_image(IPTR);
  422. extern void free_image_mem(IPTR);
  423. extern void img_free_cmap(IPTR);
  424. extern IPTR get_mem_imgptr(void);
  425. extern void free_mem_imgptr(IPTR);
  426. extern int img_get_border(IPTR, int *, int *, int *, int *, int);
  427. extern CMPTR get_mem_cmap(void);
  428. extern void free_mem_cmap(CMPTR);
  429. extern int best_format(IPTR, char *const *);
  430. extern void enumerate_formats(void (*)(const char *));
  431. extern void scale_color(int[], float, int[], int, int);
  432. extern IPTR create_image(const char *, int, int, int, rgba_t);
  433. extern int fill_image_struct(IPTR, void *, int, int, IMG_TYPE);
  434.  
  435. extern void sim_dbl_swap(IPTR, int, int, void *, int, int, int, int, int);
  436. extern void sim_op_dbl_swap(IPTR, int, int, void *, int, int, int, int);
  437. extern void mv_ras_obj(void **, int, int, int, int, int, int);
  438.  
  439. extern void normal_pc_vec(pc_t *, int, int, int);
  440. extern void interpolate_pc_vec(pc_t *, int, pc_t *, int);
  441. extern void get_bit_defmap(int, pc_t *, pc_t *, pc_t *, int);
  442. extern int get_number_of_defmaps(void);
  443.  
  444. extern void smooth_line_on(IPTR, int *, int);
  445. extern void smooth_line_off(IPTR, int *);
  446. extern void smooth_poly_on(IPTR, int *, int);
  447. extern void smooth_poly_off(void);
  448. /*
  449.  * debug mem
  450.  */
  451. extern void set_mem_warn(int);
  452. extern int get_mem_warn(void);
  453. extern void mem_stat(void);
  454.  
  455. /*
  456.  * colormap routines
  457.  */
  458. extern void set_colmap(int, pc_t *, pc_t *, pc_t *);
  459. extern void set_cmap(CMPTR);
  460. extern void set_cmap_entry(CMPTR, int p[], int);
  461. extern void get_cmap_entry(CMPTR, int p[], int);
  462. extern void get_colmap(int, pc_t *, pc_t *, pc_t *);
  463. extern void pack_cmap(CMPTR);
  464. extern void pack_cmap_g(CMPTR);
  465. extern void get_sysmap(void);
  466. extern void set_sysmap(int);
  467. extern int cmap_closematch(CMPTR, int, int, int);
  468.  
  469. extern long myqread(short *, long, long);
  470. extern void set_bk_color(rgba_t);
  471.  
  472. extern void clear_screen(long, int);
  473. extern void clear_outside_rect(const Rect_t *);
  474. extern void clear_between_rect(const Rect_t *, const Rect_t *);
  475. extern void clear_over_pup(void);
  476. extern void rect_clear(long, int, int, int, int);
  477. extern void Rectwrite(int, int, int, int, void *);
  478. extern int read_screen(IPTR, int, int, int, int);
  479. extern void set_rgb_mode(void);
  480. extern void set_cmap_mode(void);
  481. extern void set_display_mode(IPTR);
  482.  
  483.  
  484. /*
  485.  * type conversion
  486.  */
  487. extern int img_convert_type(IPTR, IMG_TYPE);
  488. extern int img_rgb_to_cpack(IPTR);
  489. extern int rgb_to_cmap(IPTR);
  490.  
  491. /*  quantization */
  492. extern int pre_quant(void);
  493. extern void set_quant_max_color(int);
  494. extern void set_quant_parameters(int, int, int);
  495. extern const char *quant_opt_string(void);
  496. extern const char *qdither_opt_string(void);
  497. extern int get_quant_p(const char *, int *, int *, int *,
  498.                const char *, int *, const char *, int *);
  499. /* b&w dither */
  500. extern const char *bw_dither_string(void);
  501. extern int pre_bw(void);
  502. extern int img_half_toning(IPTR);
  503.  
  504. extern int rgb2gray(int, int, int);
  505. extern int cpack2gray(rgba_t);
  506. extern void pick_pixel(IPTR, void *, int, int, int[]);
  507. extern void pack_pixel(IPTR, void *, int, int, int[]);
  508.  
  509. extern void img_modify_pixel(IPTR, int[], int[], int);
  510. extern void modify_cpack_pixel(rgba_t *, long, rgba_t, rgba_t, int);
  511. extern void modify_ci_pixel(ci_t *, long, ci_t, ci_t, int);
  512.  
  513. /**************** Dirty Rectangle routines ******/
  514.  
  515. extern void add_d_rect(int, int, int, int);
  516.  
  517. extern const Rect_t *img_rect(IPTR);
  518.  
  519. #ifdef TIMING
  520. extern void start_timing(void);
  521. extern void end_timing(void);
  522. extern void show_timing(void);
  523. #endif
  524. /*
  525.  * application independent stuff
  526.  */
  527. #include "ulib.h"
  528. #include "uproto.h"
  529. #include "gluproto.h"
  530. #include "gui.h"
  531.  
  532. #endif
  533.